package com.scarecrow.olga.game.component {
	import com.scarecrow.olga.core.IUpdateable;
	import com.scarecrow.olga.core.timer.GameTimer;
	/**
	 * ...
	 * @author Santiago.J.Elizalde
	 */
	public class UpdateableComponent extends GameComponent implements IUpdateable {
		
		private var _enabled:Boolean;
		
		public function UpdateableComponent() {
			super()
		}
		
		/* INTERFACE com.scarecrow.olga.core.IUpdateable */
		
		/**
		 * the enabled property indicates wether the updateableComponent will receive
		 * updates from the GameTimer or not.
		 */
		public function set enabled(value:Boolean):void {
			if (value && !enabled) {
				GameTimer.registerUpdateable(this);
			} else if (!value && enabled) {
				GameTimer.releaseUpdateable(this);
			}
			_enabled = value;
		}
		
		public function get enabled():Boolean {
			return _enabled;
		}
		
		public function update(ms:uint = 0):void {
			
		}
		
		override protected function releaseGameObject():void {
			super.releaseGameObject();
		}
		
	}

}